Telegram Group & Telegram Channel
Находим наименьшие и наибольшие

В стандартной библиотеке есть модуль heapq, который, как можно понять по названию, реализует структуру данных куча.

Особенности и пользу этой структуры данных пока что разбирать не будем, но посмотрим на два интересных метода в этом модуле.

С помощью методов nsmallest и nlargest можно получить наименьшие и наибольшие элементы в списке.

Первым аргументов передается, сколько элементов нужно взять, вторым — список.

#heap



tg-me.com/python_academy/955
Create:
Last Update:

Находим наименьшие и наибольшие

В стандартной библиотеке есть модуль heapq, который, как можно понять по названию, реализует структуру данных куча.

Особенности и пользу этой структуры данных пока что разбирать не будем, но посмотрим на два интересных метода в этом модуле.

С помощью методов nsmallest и nlargest можно получить наименьшие и наибольшие элементы в списке.

Первым аргументов передается, сколько элементов нужно взять, вторым — список.

#heap

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/955

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Telegram has exploded as a hub for cybercriminals looking to buy, sell and share stolen data and hacking tools, new research shows, as the messaging app emerges as an alternative to the dark web.An investigation by cyber intelligence group Cyberint, together with the Financial Times, found a ballooning network of hackers sharing data leaks on the popular messaging platform, sometimes in channels with tens of thousands of subscribers, lured by its ease of use and light-touch moderation.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Python Academy from cn


Telegram Python Academy
FROM USA